package com.example.springboots.controller;


import com.example.springboots.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class LoginContoller {

    @PostMapping("/login")
    public String toLogin(HttpServletRequest reques, String usrName, String usrPassword){
        if (usrName.equals("admin") && usrPassword.equals("111111")){
            reques.getSession().setAttribute("loginUser","admin");
            return "redirect:main";
        }
        return "login";
    }

    @GetMapping("/main")
    public String toMain(){
        return "main";
    }
}
